# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-vulndb
pkgname=('python2-vulndb' 'python-vulndb')
_pkgname=vulndb
pkgver=0.1.3
pkgrel=7
pkgdesc='Provides access to the vulndb information.'
arch=('any')
url='https://pypi.org/project/vulndb/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('89007130636829571057cb3863df6b32906505ba71eb34d36d37ef67dbb0fd678260cded1f49e995ba6d1baa462dfd2957e4effb72e793e0c0bb48c72efcc0ae')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-vulndb() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-vulndb() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

